package com.platform.api.bzproject.controller;


import com.platform.api.bzproject.model.BzNotice;
import com.platform.api.bzproject.service.BzNoticeService;
import com.platform.common.core.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author guoyunfei on 2021/7/9 14:04
 * @className BzNoticeMapper
 * @description TODO
 * @Version 1.0
 * 源码联系微信：2549789059
 */
@Api(tags = "公告信息")
@RestController
@RequestMapping("{appid}/notice")
public class BzNoticeController {

    @Autowired
    private BzNoticeService bzNoticeService;

    @ApiOperation(value = "首页公告列表", notes="首页公告列表")
    @GetMapping("/notices")
    public Result notices(Integer type){
        BzNotice notice =new BzNotice();
        notice.setEnable(1);
        notice.setType(type);
        List<BzNotice> bzNotices = bzNoticeService.selectList(notice);
        return Result.success(bzNotices);
    }

    @GetMapping("/getById")
    public Result getById(Integer id){
        BzNotice notice = bzNoticeService.getById(id);
        return Result.success(notice);
    }


    @GetMapping("/getDateSub3")
    public Result getDateSub3(Integer id){
        return Result.success(bzNoticeService.getDateSub3());
    }



}
